<!DOCTYPE html>
<html lang="zh-Hans">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.4.0">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/all.min.css" integrity="sha256-2H3fkXt6FEmrReK448mDVGKb3WW2ZZw35gI7vqHOE4Y=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{&quot;hostname&quot;:&quot;www.nilstorm.com&quot;,&quot;root&quot;:&quot;&#x2F;&quot;,&quot;images&quot;:&quot;&#x2F;images&quot;,&quot;scheme&quot;:&quot;Gemini&quot;,&quot;version&quot;:&quot;8.5.0&quot;,&quot;exturl&quot;:false,&quot;sidebar&quot;:{&quot;position&quot;:&quot;left&quot;,&quot;display&quot;:&quot;post&quot;,&quot;padding&quot;:18,&quot;offset&quot;:12},&quot;copycode&quot;:false,&quot;bookmark&quot;:{&quot;enable&quot;:false,&quot;color&quot;:&quot;#222&quot;,&quot;save&quot;:&quot;auto&quot;},&quot;fancybox&quot;:false,&quot;mediumzoom&quot;:false,&quot;lazyload&quot;:false,&quot;pangu&quot;:false,&quot;comments&quot;:{&quot;style&quot;:&quot;tabs&quot;,&quot;active&quot;:null,&quot;storage&quot;:true,&quot;lazyload&quot;:false,&quot;nav&quot;:null},&quot;motion&quot;:{&quot;enable&quot;:true,&quot;async&quot;:false,&quot;transition&quot;:{&quot;post_block&quot;:&quot;fadeIn&quot;,&quot;post_header&quot;:&quot;fadeInDown&quot;,&quot;post_body&quot;:&quot;fadeInDown&quot;,&quot;coll_header&quot;:&quot;fadeInLeft&quot;,&quot;sidebar&quot;:&quot;fadeInUp&quot;}},&quot;prism&quot;:false,&quot;i18n&quot;:{&quot;placeholder&quot;:&quot;Searching...&quot;,&quot;empty&quot;:&quot;We didn&#39;t find any results for the search: ${query}&quot;,&quot;hits_time&quot;:&quot;${hits} results found in ${time} ms&quot;,&quot;hits&quot;:&quot;${hits} results found&quot;}}</script><script src="/js/config.js"></script>
<meta name="description" content="DLS_DEAD_LOCAL_STORE 翻译Dead store to .. in …This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, becau">
<meta property="og:type" content="article">
<meta property="og:title" content="FindBugs 规则整理：Style &amp; Dodgy">
<meta property="og:url" content="http://www.nilstorm.com/2017/eb74f6c5.html">
<meta property="og:site_name" content="Lam&#39;s Blog">
<meta property="og:description" content="DLS_DEAD_LOCAL_STORE 翻译Dead store to .. in …This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, becau">
<meta property="og:locale">
<meta property="og:image" content="https://tva1.sinaimg.cn/large/007S8ZIlgy1gee6wkfo69j30e9026gm4.jpg">
<meta property="article:published_time" content="2017-03-03T02:36:36.000Z">
<meta property="article:modified_time" content="2021-06-06T08:08:18.171Z">
<meta property="article:author" content="LinBinghe">
<meta property="article:tag" content="FindBugs">
<meta property="article:tag" content="规则">
<meta property="article:tag" content="Dodgy">
<meta property="article:tag" content="Style">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://tva1.sinaimg.cn/large/007S8ZIlgy1gee6wkfo69j30e9026gm4.jpg">


<link rel="canonical" href="http://www.nilstorm.com/2017/eb74f6c5.html">



<script class="next-config" data-name="page" type="application/json">{&quot;sidebar&quot;:&quot;&quot;,&quot;isHome&quot;:false,&quot;isPost&quot;:true,&quot;lang&quot;:&quot;zh-Hans&quot;,&quot;comments&quot;:true,&quot;permalink&quot;:&quot;http:&#x2F;&#x2F;www.nilstorm.com&#x2F;2017&#x2F;eb74f6c5.html&quot;,&quot;path&quot;:&quot;2017&#x2F;eb74f6c5.html&quot;,&quot;title&quot;:&quot;FindBugs 规则整理：Style &amp; Dodgy&quot;}</script>

<script class="next-config" data-name="calendar" type="application/json">&quot;&quot;</script>
<title>FindBugs 规则整理：Style & Dodgy | Lam's Blog</title>
  




  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>
<link rel="alternate" href="/atom.xml" title="Lam's Blog" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <div class="headband"></div>

  <main class="main">
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="Toggle navigation bar" role="button">
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <h1 class="site-title">Lam's Blog</h1>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">Knowledge as Action</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger">
    </div>
  </div>
</div>







</div>
        
  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>

  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          Table of Contents
        </li>
        <li class="sidebar-nav-overview">
          Overview
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#DLS-DEAD-LOCAL-STORE"><span class="nav-number">1.</span> <span class="nav-text">DLS_DEAD_LOCAL_STORE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DLS-DEAD-LOCAL-STORE-SHADOWS-FIELD"><span class="nav-number">2.</span> <span class="nav-text">DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ST-WRITE-TO-STATIC-FROM-INSTANCE-METHOD"><span class="nav-number">3.</span> <span class="nav-text">ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#XSS-REQUEST-PARAMETER-TO-SEND-ERROR"><span class="nav-number">4.</span> <span class="nav-text">XSS_REQUEST_PARAMETER_TO_SEND_ERROR</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#XSS-REQUEST-PARAMETER-TO-SERVLET-WRITER"><span class="nav-number">5.</span> <span class="nav-text">XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#BC-BAD-CAST-TO-ABSTRACT-COLLECTION"><span class="nav-number">6.</span> <span class="nav-text">BC_BAD_CAST_TO_ABSTRACT_COLLECTION</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#BC-BAD-CAST-TO-CONCRETE-COLLECTION"><span class="nav-number">7.</span> <span class="nav-text">BC_BAD_CAST_TO_CONCRETE_COLLECTION</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#BC-UNCONFIRMED-CAST"><span class="nav-number">8.</span> <span class="nav-text">BC_UNCONFIRMED_CAST</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#BC-VACUOUS-INSTANCEOF"><span class="nav-number">9.</span> <span class="nav-text">BC_VACUOUS_INSTANCEOF</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ICAST-QUESTIONABLE-UNSIGNED-RIGHT-SHIFT"><span class="nav-number">10.</span> <span class="nav-text">ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#CI-CONFUSED-INHERITANCE"><span class="nav-number">11.</span> <span class="nav-text">CI_CONFUSED_INHERITANCE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DB-DUPLICATE-BRANCHES"><span class="nav-number">12.</span> <span class="nav-text">DB_DUPLICATE_BRANCHES</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DB-DUPLICATE-SWITCH-CLAUSES"><span class="nav-number">13.</span> <span class="nav-text">DB_DUPLICATE_SWITCH_CLAUSES</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DLS-DEAD-LOCAL-STORE-IN-RETURN"><span class="nav-number">14.</span> <span class="nav-text">DLS_DEAD_LOCAL_STORE_IN_RETURN</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DLS-DEAD-LOCAL-STORE-OF-NULL"><span class="nav-number">15.</span> <span class="nav-text">DLS_DEAD_LOCAL_STORE_OF_NULL</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DMI-HARDCODED-ABSOLUTE-FILENAME"><span class="nav-number">16.</span> <span class="nav-text">DMI_HARDCODED_ABSOLUTE_FILENAME</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DMI-NONSERIALIZABLE-OBJECT-WRITTEN"><span class="nav-number">17.</span> <span class="nav-text">DMI_NONSERIALIZABLE_OBJECT_WRITTEN</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#DMI-USELESS-SUBSTRING"><span class="nav-number">18.</span> <span class="nav-text">DMI_USELESS_SUBSTRING</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#EQ-DOESNT-OVERRIDE-EQUALS"><span class="nav-number">19.</span> <span class="nav-text">EQ_DOESNT_OVERRIDE_EQUALS</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#FE-FLOATING-POINT-EQUALITY"><span class="nav-number">20.</span> <span class="nav-text">FE_FLOATING_POINT_EQUALITY</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#VA-FORMAT-STRING-BAD-CONVERSION-TO-BOOLEAN"><span class="nav-number">21.</span> <span class="nav-text">VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#IC-INIT-CIRCULARITY"><span class="nav-number">22.</span> <span class="nav-text">IC_INIT_CIRCULARITY</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ICAST-IDIV-CAST-TO-DOUBLE"><span class="nav-number">23.</span> <span class="nav-text">ICAST_IDIV_CAST_TO_DOUBLE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ICAST-INTEGER-MULTIPLY-CAST-TO-LONG"><span class="nav-number">24.</span> <span class="nav-text">ICAST_INTEGER_MULTIPLY_CAST_TO_LONG</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#IM-AVERAGE-COMPUTATION-COULD-OVERFLOW"><span class="nav-number">25.</span> <span class="nav-text">IM_AVERAGE_COMPUTATION_COULD_OVERFLOW</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#INT-VACUOUS-COMPARISON"><span class="nav-number">26.</span> <span class="nav-text">INT_VACUOUS_COMPARISON</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#MTIA-SUSPECT-SERVLET-INSTANCE-FIELD"><span class="nav-number">27.</span> <span class="nav-text">MTIA_SUSPECT_SERVLET_INSTANCE_FIELD</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#MTIA-SUSPECT-STRUTS-INSTANCE-FIELD"><span class="nav-number">28.</span> <span class="nav-text">MTIA_SUSPECT_STRUTS_INSTANCE_FIELD</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NP-DEREFERENCE-OF-READLINE-VALUE"><span class="nav-number">29.</span> <span class="nav-text">NP_DEREFERENCE_OF_READLINE_VALUE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NP-IMMEDIATE-DEREFERENCE-OF-READLINE"><span class="nav-number">30.</span> <span class="nav-text">NP_IMMEDIATE_DEREFERENCE_OF_READLINE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NP-NULL-ON-SOME-PATH-FROM-RETURN-VALUE"><span class="nav-number">31.</span> <span class="nav-text">NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NP-PARAMETER-MUST-BE-NONNULL-BUT-MARKED-AS-NULLABLE"><span class="nav-number">32.</span> <span class="nav-text">NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NS-DANGEROUS-NON-SHORT-CIRCUIT"><span class="nav-number">33.</span> <span class="nav-text">NS_DANGEROUS_NON_SHORT_CIRCUIT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#NS-NON-SHORT-CIRCUIT"><span class="nav-number">34.</span> <span class="nav-text">NS_NON_SHORT_CIRCUIT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#PZLA-PREFER-ZERO-LENGTH-ARRAYS"><span class="nav-number">35.</span> <span class="nav-text">PZLA_PREFER_ZERO_LENGTH_ARRAYS</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#QF-QUESTIONABLE-FOR-LOOP"><span class="nav-number">36.</span> <span class="nav-text">QF_QUESTIONABLE_FOR_LOOP</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RCN-REDUNDANT-COMPARISON-OF-NULL-AND-NONNULL-VALUE"><span class="nav-number">37.</span> <span class="nav-text">RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RCN-REDUNDANT-COMPARISON-TWO-NULL-VALUES"><span class="nav-number">38.</span> <span class="nav-text">RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RCN-REDUNDANT-NULLCHECK-OF-NONNULL-VALUE"><span class="nav-number">39.</span> <span class="nav-text">RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#REC-CATCH-EXCEPTION"><span class="nav-number">40.</span> <span class="nav-text">REC_CATCH_EXCEPTION</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RI-REDUNDANT-INTERFACES"><span class="nav-number">41.</span> <span class="nav-text">RI_REDUNDANT_INTERFACES</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RV-DONT-JUST-NULL-CHECK-READLINE"><span class="nav-number">42.</span> <span class="nav-text">RV_DONT_JUST_NULL_CHECK_READLINE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#RV-REM-OF-RANDOM-INT"><span class="nav-number">43.</span> <span class="nav-text">RV_REM_OF_RANDOM_INT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SA-LOCAL-DOUBLE-ASSIGNMENT"><span class="nav-number">44.</span> <span class="nav-text">SA_LOCAL_DOUBLE_ASSIGNMENT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SA-LOCAL-SELF-ASSIGNMENT"><span class="nav-number">45.</span> <span class="nav-text">SA_LOCAL_SELF_ASSIGNMENT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SF-SWITCH-FALLTHROUGH"><span class="nav-number">46.</span> <span class="nav-text">SF_SWITCH_FALLTHROUGH</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SF-SWITCH-NO-DEFAULT"><span class="nav-number">47.</span> <span class="nav-text">SF_SWITCH_NO_DEFAULT</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#SE-PRIVATE-READ-RESOLVE-NOT-INHERITED"><span class="nav-number">48.</span> <span class="nav-text">SE_PRIVATE_READ_RESOLVE_NOT_INHERITED</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#UCF-USELESS-CONTROL-FLOW"><span class="nav-number">49.</span> <span class="nav-text">UCF_USELESS_CONTROL_FLOW</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#UCF-USELESS-CONTROL-FLOW-NEXT-LINE"><span class="nav-number">50.</span> <span class="nav-text">UCF_USELESS_CONTROL_FLOW_NEXT_LINE</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#UWF-FIELD-NOT-INITIALIZED-IN-CONSTRUCTOR"><span class="nav-number">51.</span> <span class="nav-text">UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#XFB-XML-FACTORY-BYPASS"><span class="nav-number">52.</span> <span class="nav-text">XFB_XML_FACTORY_BYPASS</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%85%B6%E4%BB%96%E6%96%87%E7%AB%A0%EF%BC%88%E6%8C%81%E7%BB%AD%E6%9B%B4%E6%96%B0%EF%BC%89"><span class="nav-number">53.</span> <span class="nav-text">其他文章（持续更新）</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E5%BC%95%E7%94%A8"><span class="nav-number">54.</span> <span class="nav-text">引用</span></a></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="LinBinghe"
      src="/images/avatar.jpg">
  <p class="site-author-name" itemprop="name">LinBinghe</p>
  <div class="site-description" itemprop="description">Knowledge as Action</div>
</div>
<div class="site-state-wrap site-overview-item animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives">
          <span class="site-state-item-count">39</span>
          <span class="site-state-item-name">posts</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
        <span class="site-state-item-count">13</span>
        <span class="site-state-item-name">categories</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
        <span class="site-state-item-count">60</span>
        <span class="site-state-item-name">tags</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author site-overview-item animated">
      <span class="links-of-author-item">
        <a href="https://github.com/LinBinghe" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;LinBinghe" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.zhihu.com/people/shawn_lam" title="Zhihu → https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;shawn_lam" rel="noopener" target="_blank"><i class="fab fa-zhihu fa-fw"></i></a>
      </span>
      <span class="links-of-author-item">
        <a href="mailto:linbinghe@gmail.com" title="E-Mail → mailto:linbinghe@gmail.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i></a>
      </span>
  </div>



        </div>
      </div>
    </div>
  </aside>
  <div class="sidebar-dimmer"></div>


    </header>

    
  <div class="back-to-top" role="button" aria-label="Back to top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>


    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-Hans">
    <link itemprop="mainEntityOfPage" href="http://www.nilstorm.com/2017/eb74f6c5.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/avatar.jpg">
      <meta itemprop="name" content="LinBinghe">
      <meta itemprop="description" content="Knowledge as Action">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Lam's Blog">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          FindBugs 规则整理：Style & Dodgy
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">Posted on</span>

      <time title="Created: 2017-03-03 10:36:36" itemprop="dateCreated datePublished" datetime="2017-03-03T10:36:36+08:00">2017-03-03</time>
    </span>
      <span class="post-meta-item">
        <span class="post-meta-item-icon">
          <i class="far fa-calendar-check"></i>
        </span>
        <span class="post-meta-item-text">Edited on</span>
        <time title="Modified: 2021-06-06 16:08:18" itemprop="dateModified" datetime="2021-06-06T16:08:18+08:00">2021-06-06</time>
      </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">In</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/FindBugs/" itemprop="url" rel="index"><span itemprop="name">FindBugs</span></a>
        </span>
    </span>

  
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">
        <h1 id="DLS-DEAD-LOCAL-STORE"><a href="#DLS-DEAD-LOCAL-STORE" class="headerlink" title="DLS_DEAD_LOCAL_STORE"></a>DLS_DEAD_LOCAL_STORE</h1><ul>
<li>翻译<br><em>Dead store to .. in …<br>This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used.<br>Note that Sun’s javac compiler often generates dead stores for final local variables. Because FindBugs is a bytecode-based tool, there is no easy way to eliminate these false positives.</em><br>某个局部变量没有被应用过，这通常存在问题，但是javac编译器在编译局部变量时，也会产生dead stores，从而倒是FindBugs误报。<span id="more"></span></li>
<li>原因<br>同翻译</li>
<li>解决方案<br>删除无用的局部变量或视情况而定</li>
</ul>
<h1 id="DLS-DEAD-LOCAL-STORE-SHADOWS-FIELD"><a href="#DLS-DEAD-LOCAL-STORE-SHADOWS-FIELD" class="headerlink" title="DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD"></a>DLS_DEAD_LOCAL_STORE_SHADOWS_FIELD</h1><ul>
<li>翻译<br><em>Dead store to … rather than field with same name in …<br>This instruction assigns a value to a local variable, but the value is not read or used in any subsequent instruction. Often, this indicates an error, because the value computed is never used. There is a field with the same name as the local variable. Did you mean to assign to that variable instead?</em><br>成员变量和局部变量重名</li>
<li>原因<br>同翻译</li>
<li>解决方案<br>修改某一个变量的命名</li>
</ul>
<h1 id="ST-WRITE-TO-STATIC-FROM-INSTANCE-METHOD"><a href="#ST-WRITE-TO-STATIC-FROM-INSTANCE-METHOD" class="headerlink" title="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"></a>ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD</h1><ul>
<li>翻译<br><em>Write to static field … from instance method …<br>This instance method writes to a static field. This is tricky to get correct if multiple instances are being manipulated, and generally bad practice.</em><br>实例方法往静态域中执行写入操作，这会导致共享问题，因为其他实例也会访问该静态变量，但是却不知道某个实例已经修改了该静态变量的引用，导致不可预知的问题</li>
<li>原因<br>同翻译</li>
<li>解决方案<br>将修改静态域的实例方法改为静态方法</li>
</ul>
<h1 id="XSS-REQUEST-PARAMETER-TO-SEND-ERROR"><a href="#XSS-REQUEST-PARAMETER-TO-SEND-ERROR" class="headerlink" title="XSS_REQUEST_PARAMETER_TO_SEND_ERROR"></a>XSS_REQUEST_PARAMETER_TO_SEND_ERROR</h1><p><em>Servlet reflected cross site scripting vulnerability</em><br>在代码中在Servlet输出中直接写入一个HTTP参数，这会造成一个跨站点的脚本漏洞。</p>
<h1 id="XSS-REQUEST-PARAMETER-TO-SERVLET-WRITER"><a href="#XSS-REQUEST-PARAMETER-TO-SERVLET-WRITER" class="headerlink" title="XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER"></a>XSS_REQUEST_PARAMETER_TO_SERVLET_WRITER</h1><p><em>Servlet reflected cross site scripting vulnerability</em><br>代码直接写入参数的HTTP服务器错误页（使用HttpServletResponse.sendError）。表达了类似的不受信任的输入会引起跨站点脚本漏洞。</p>
<h1 id="BC-BAD-CAST-TO-ABSTRACT-COLLECTION"><a href="#BC-BAD-CAST-TO-ABSTRACT-COLLECTION" class="headerlink" title="BC_BAD_CAST_TO_ABSTRACT_COLLECTION"></a>BC_BAD_CAST_TO_ABSTRACT_COLLECTION</h1><p><em>Questionable cast to abstract collection</em><br>在代码中把一个集合强制类型转换为一个抽象的集合（如list，set或map）。保证该对象类型和将要转换的类型是一致的。如果你只是想要便利一个集合，那么你就不必将它转换为Set或List。</p>
<h1 id="BC-BAD-CAST-TO-CONCRETE-COLLECTION"><a href="#BC-BAD-CAST-TO-CONCRETE-COLLECTION" class="headerlink" title="BC_BAD_CAST_TO_CONCRETE_COLLECTION"></a>BC_BAD_CAST_TO_CONCRETE_COLLECTION</h1><p><em>Questionable cast to concrete collection</em><br>代码把抽象的集合（如List，Set，或Collection）强制转换为具体落实类型（如一个ArrayList或HashSet）。这可能不正确，也可能使您的代码很脆弱，因为它使得难以在今后的切换指向其他具体实现。除非你有特别理由这样做，否则只需要使用抽象的集合类。</p>
<h1 id="BC-UNCONFIRMED-CAST"><a href="#BC-UNCONFIRMED-CAST" class="headerlink" title="BC_UNCONFIRMED_CAST"></a>BC_UNCONFIRMED_CAST</h1><p><em>Unchecked/unconfirmed cast</em><br>强制类型转换操作没有经过验证，而且不是所有的此种类型装换过的类都可以再强制类型转换为原类型。在代码中需要进行逻辑判断以保证可以进行这样的操作。</p>
<h1 id="BC-VACUOUS-INSTANCEOF"><a href="#BC-VACUOUS-INSTANCEOF" class="headerlink" title="BC_VACUOUS_INSTANCEOF"></a>BC_VACUOUS_INSTANCEOF</h1><p><em>instanceof will always return true</em><br>instanceof测试将始终返回真（除非被测试的值为空）。虽然这是安全，确保它是不是说明一些误解或其他一些逻辑错误。如果你真的想测试是空的价值，也许会更清楚这样做的更好空试验，而不是一个instanceof测试。这种情况可能发生中该实例肯定是该类的对象。</p>
<h1 id="ICAST-QUESTIONABLE-UNSIGNED-RIGHT-SHIFT"><a href="#ICAST-QUESTIONABLE-UNSIGNED-RIGHT-SHIFT" class="headerlink" title="ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT"></a>ICAST_QUESTIONABLE_UNSIGNED_RIGHT_SHIFT</h1><p><em>Unsigned right shift cast to short/byte</em><br>无符号数右移后进行转换为short或者byte类型时可能会丢弃掉高位的值，这样的结果就是有符合数和无符号数无法区分（这取决于移位大小）</p>
<h1 id="CI-CONFUSED-INHERITANCE"><a href="#CI-CONFUSED-INHERITANCE" class="headerlink" title="CI_CONFUSED_INHERITANCE"></a>CI_CONFUSED_INHERITANCE</h1><p><em>Class is final but declares protected field</em><br>这个类被声明为final的，而是字段属性却声明为保护类型的。由于是final类，它不能再被继承，而再声明为保护类型的很容易造成混淆。为了从外部能正确的使用它应该把它们声明为private或者public类型。</p>
<h1 id="DB-DUPLICATE-BRANCHES"><a href="#DB-DUPLICATE-BRANCHES" class="headerlink" title="DB_DUPLICATE_BRANCHES"></a>DB_DUPLICATE_BRANCHES</h1><p><em>Method uses the same code for two branches</em><br>此方法使用相同的代码，以实现两个有条件的分支。检查以确保这是不是一个编码错误。</p>
<h1 id="DB-DUPLICATE-SWITCH-CLAUSES"><a href="#DB-DUPLICATE-SWITCH-CLAUSES" class="headerlink" title="DB_DUPLICATE_SWITCH_CLAUSES"></a>DB_DUPLICATE_SWITCH_CLAUSES</h1><p><em>Method uses the same code for two switch clauses</em><br>他的方法使用相同的代码来实现两个switch的声明条款。这可能是重复代码的情况，但可能也显示出编码的错误。</p>
<h1 id="DLS-DEAD-LOCAL-STORE-IN-RETURN"><a href="#DLS-DEAD-LOCAL-STORE-IN-RETURN" class="headerlink" title="DLS_DEAD_LOCAL_STORE_IN_RETURN"></a>DLS_DEAD_LOCAL_STORE_IN_RETURN</h1><p><em>Useless assignment in return statement</em><br>本声明把一个局部变量放到方法的返回语句中。这对于方法中局部变量来说是没有意义的。</p>
<h1 id="DLS-DEAD-LOCAL-STORE-OF-NULL"><a href="#DLS-DEAD-LOCAL-STORE-OF-NULL" class="headerlink" title="DLS_DEAD_LOCAL_STORE_OF_NULL"></a>DLS_DEAD_LOCAL_STORE_OF_NULL</h1><p><em>Dead store of null to local variable</em><br>把一个本地变量赋值为null值，并且再也没有对这个变量做任何的操作。这样可能是为了垃圾回收，而在Java SE 6.0，这已不再需要。</p>
<h1 id="DMI-HARDCODED-ABSOLUTE-FILENAME"><a href="#DMI-HARDCODED-ABSOLUTE-FILENAME" class="headerlink" title="DMI_HARDCODED_ABSOLUTE_FILENAME"></a>DMI_HARDCODED_ABSOLUTE_FILENAME</h1><p><em>Code contains a hard coded reference to an absolute pathname</em><br>类包含一个硬编码的绝对路径</p>
<h1 id="DMI-NONSERIALIZABLE-OBJECT-WRITTEN"><a href="#DMI-NONSERIALIZABLE-OBJECT-WRITTEN" class="headerlink" title="DMI_NONSERIALIZABLE_OBJECT_WRITTEN"></a>DMI_NONSERIALIZABLE_OBJECT_WRITTEN</h1><p><em>Non serializable object written to ObjectOutput</em><br>代码中让一个非序列化的对象出现在ObjectOutput.writeObject()方法中，这样会引起一个错误。</p>
<h1 id="DMI-USELESS-SUBSTRING"><a href="#DMI-USELESS-SUBSTRING" class="headerlink" title="DMI_USELESS_SUBSTRING"></a>DMI_USELESS_SUBSTRING</h1><p><em>Invocation of substring(0), which returns the original value</em><br>此代码调用了subString(0)方法，它将返回原来的值。</p>
<h1 id="EQ-DOESNT-OVERRIDE-EQUALS"><a href="#EQ-DOESNT-OVERRIDE-EQUALS" class="headerlink" title="EQ_DOESNT_OVERRIDE_EQUALS"></a>EQ_DOESNT_OVERRIDE_EQUALS</h1><p><em>Class doesn’t override equals in superclass</em><br>子类定义了一个新的equals方法但是却不是覆写了父类本省的equals()方法。</p>
<h1 id="FE-FLOATING-POINT-EQUALITY"><a href="#FE-FLOATING-POINT-EQUALITY" class="headerlink" title="FE_FLOATING_POINT_EQUALITY"></a>FE_FLOATING_POINT_EQUALITY</h1><p><em>Test for floating point equality</em><br>此操作比较两个浮点值是否相等。由于浮点运算可能会涉及到舍入，计算float和double值可能不准确。如果要求值必须准确，如货币值，可以考虑使用固定精度类型，如BigDecimal类型的值来比较</p>
<h1 id="VA-FORMAT-STRING-BAD-CONVERSION-TO-BOOLEAN"><a href="#VA-FORMAT-STRING-BAD-CONVERSION-TO-BOOLEAN" class="headerlink" title="VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN"></a>VA_FORMAT_STRING_BAD_CONVERSION_TO_BOOLEAN</h1><p><em>Non-Boolean argument formatted using %b format specifier</em><br>使用%b去格式化Boolean类型的值是不正确的，但是它不会抛出异常，任何非空的值都会输出true，任何为空的值都会输出false</p>
<h1 id="IC-INIT-CIRCULARITY"><a href="#IC-INIT-CIRCULARITY" class="headerlink" title="IC_INIT_CIRCULARITY"></a>IC_INIT_CIRCULARITY</h1><p><em>Initialization circularity</em><br>初始化死循环</p>
<h1 id="ICAST-IDIV-CAST-TO-DOUBLE"><a href="#ICAST-IDIV-CAST-TO-DOUBLE" class="headerlink" title="ICAST_IDIV_CAST_TO_DOUBLE"></a>ICAST_IDIV_CAST_TO_DOUBLE</h1><p><em>integral division result cast to double or float</em><br>整形数除法强制转换为double或者float类型。</p>
<h1 id="ICAST-INTEGER-MULTIPLY-CAST-TO-LONG"><a href="#ICAST-INTEGER-MULTIPLY-CAST-TO-LONG" class="headerlink" title="ICAST_INTEGER_MULTIPLY_CAST_TO_LONG"></a>ICAST_INTEGER_MULTIPLY_CAST_TO_LONG</h1><p><em>Result of integer multiplication cast to long</em><br>整形乘法的结果转换为long型</p>
<h1 id="IM-AVERAGE-COMPUTATION-COULD-OVERFLOW"><a href="#IM-AVERAGE-COMPUTATION-COULD-OVERFLOW" class="headerlink" title="IM_AVERAGE_COMPUTATION_COULD_OVERFLOW"></a>IM_AVERAGE_COMPUTATION_COULD_OVERFLOW</h1><p><em>Computation of average could overflow</em><br>计算平均值可能溢出</p>
<h1 id="INT-VACUOUS-COMPARISON"><a href="#INT-VACUOUS-COMPARISON" class="headerlink" title="INT_VACUOUS_COMPARISON"></a>INT_VACUOUS_COMPARISON</h1><p><em>Vacuous comparison of integer value</em><br>整形数进行比较结果总是不变。例如：x &lt;= Integer.MAX_VALUE</p>
<h1 id="MTIA-SUSPECT-SERVLET-INSTANCE-FIELD"><a href="#MTIA-SUSPECT-SERVLET-INSTANCE-FIELD" class="headerlink" title="MTIA_SUSPECT_SERVLET_INSTANCE_FIELD"></a>MTIA_SUSPECT_SERVLET_INSTANCE_FIELD</h1><p><em>Class extends Servlet class and uses instance variables</em><br>这个类扩展从Servlet类，并使用实例的成员变量。由于只有一个Servlet类的实例，并在多线程方式使用，这种模式有可能存在问题。考虑只使用方法的局部变量。</p>
<h1 id="MTIA-SUSPECT-STRUTS-INSTANCE-FIELD"><a href="#MTIA-SUSPECT-STRUTS-INSTANCE-FIELD" class="headerlink" title="MTIA_SUSPECT_STRUTS_INSTANCE_FIELD"></a>MTIA_SUSPECT_STRUTS_INSTANCE_FIELD</h1><p><em>Class extends Struts Action class and uses instance variables</em><br>类扩展自Struts的Action类并使用这个实例的成员变量，因为在Struts框架中只存在一个Action实例对象并且使用在多线程的情况下很可能会出现问题。</p>
<h1 id="NP-DEREFERENCE-OF-READLINE-VALUE"><a href="#NP-DEREFERENCE-OF-READLINE-VALUE" class="headerlink" title="NP_DEREFERENCE_OF_READLINE_VALUE"></a>NP_DEREFERENCE_OF_READLINE_VALUE</h1><p><em>Dereference of the result of readLine() without nullcheck</em><br>对readLine()的结果值没有进行判空操作就去重新赋值，这样的操作可以会抛出空指针异常。</p>
<h1 id="NP-IMMEDIATE-DEREFERENCE-OF-READLINE"><a href="#NP-IMMEDIATE-DEREFERENCE-OF-READLINE" class="headerlink" title="NP_IMMEDIATE_DEREFERENCE_OF_READLINE"></a>NP_IMMEDIATE_DEREFERENCE_OF_READLINE</h1><p><em>Immediate dereference of the result of readLine()</em><br>对readLine()的结果立即赋值，这样的操作可以会抛出空指针异常。</p>
<h1 id="NP-NULL-ON-SOME-PATH-FROM-RETURN-VALUE"><a href="#NP-NULL-ON-SOME-PATH-FROM-RETURN-VALUE" class="headerlink" title="NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE"></a>NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE</h1><p><em>Possible null pointer dereference due to return value of called method</em><br>方法的返回值没有进行是否为空的检查就重新赋值，这样可能会出现空指针异常。</p>
<h1 id="NP-PARAMETER-MUST-BE-NONNULL-BUT-MARKED-AS-NULLABLE"><a href="#NP-PARAMETER-MUST-BE-NONNULL-BUT-MARKED-AS-NULLABLE" class="headerlink" title="NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE"></a>NP_PARAMETER_MUST_BE_NONNULL_BUT_MARKED_AS_NULLABLE</h1><p><em>Parameter must be nonnull but is marked as nullable</em><br>参数值在任何情况下都不能为空，但是有明确的注释它可以为空。</p>
<h1 id="NS-DANGEROUS-NON-SHORT-CIRCUIT"><a href="#NS-DANGEROUS-NON-SHORT-CIRCUIT" class="headerlink" title="NS_DANGEROUS_NON_SHORT_CIRCUIT"></a>NS_DANGEROUS_NON_SHORT_CIRCUIT</h1><p><em>Potentially dangerous use of non-short-circuit logic</em><br>代码中使用（&amp; or |）代替（&amp;&amp; or ||）操作，这会造成潜在的危险。</p>
<h1 id="NS-NON-SHORT-CIRCUIT"><a href="#NS-NON-SHORT-CIRCUIT" class="headerlink" title="NS_NON_SHORT_CIRCUIT"></a>NS_NON_SHORT_CIRCUIT</h1><p><em>Questionable use of non-short-circuit logic</em><br>代码中使用（&amp; or |）代替（&amp;&amp; or ||）操作，会引起不安全的操作</p>
<h1 id="PZLA-PREFER-ZERO-LENGTH-ARRAYS"><a href="#PZLA-PREFER-ZERO-LENGTH-ARRAYS" class="headerlink" title="PZLA_PREFER_ZERO_LENGTH_ARRAYS"></a>PZLA_PREFER_ZERO_LENGTH_ARRAYS</h1><p><em>Consider returning a zero length array rather than null</em><br>考虑返回一个零长度的数组，而不是null值</p>
<h1 id="QF-QUESTIONABLE-FOR-LOOP"><a href="#QF-QUESTIONABLE-FOR-LOOP" class="headerlink" title="QF_QUESTIONABLE_FOR_LOOP"></a>QF_QUESTIONABLE_FOR_LOOP</h1><p><em>Complicated, subtle or wrong increment in for-loop</em><br> for循环中存在复杂，微妙或者错误的自增</p>
<h1 id="RCN-REDUNDANT-COMPARISON-OF-NULL-AND-NONNULL-VALUE"><a href="#RCN-REDUNDANT-COMPARISON-OF-NULL-AND-NONNULL-VALUE" class="headerlink" title="RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE"></a>RCN_REDUNDANT_COMPARISON_OF_NULL_AND_NONNULL_VALUE</h1><p><em>Redundant comparison of non-null value to null</em><br> 重复比较非空值和null</p>
<h1 id="RCN-REDUNDANT-COMPARISON-TWO-NULL-VALUES"><a href="#RCN-REDUNDANT-COMPARISON-TWO-NULL-VALUES" class="headerlink" title="RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES"></a>RCN_REDUNDANT_COMPARISON_TWO_NULL_VALUES</h1><p><em>Redundant comparison of two null values</em><br>方法中对两个null值进行比较</p>
<h1 id="RCN-REDUNDANT-NULLCHECK-OF-NONNULL-VALUE"><a href="#RCN-REDUNDANT-NULLCHECK-OF-NONNULL-VALUE" class="headerlink" title="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"></a>RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE</h1><p><em>Redundant nullcheck of value known to be non-null</em><br>方法中对不为空的值进行为空的判断。</p>
<h1 id="REC-CATCH-EXCEPTION"><a href="#REC-CATCH-EXCEPTION" class="headerlink" title="REC_CATCH_EXCEPTION"></a>REC_CATCH_EXCEPTION</h1><p><em>Exception is caught when Exception is not thrown</em><br>捕获了没有抛出的异常</p>
<h1 id="RI-REDUNDANT-INTERFACES"><a href="#RI-REDUNDANT-INTERFACES" class="headerlink" title="RI_REDUNDANT_INTERFACES"></a>RI_REDUNDANT_INTERFACES</h1><p><em>Class implements same interface as superclass</em><br>子类和父类都实现了同一个接口，这种定义是多余的。</p>
<h1 id="RV-DONT-JUST-NULL-CHECK-READLINE"><a href="#RV-DONT-JUST-NULL-CHECK-READLINE" class="headerlink" title="RV_DONT_JUST_NULL_CHECK_READLINE"></a>RV_DONT_JUST_NULL_CHECK_READLINE</h1><p><em>Method discards result of readLine after checking if it is nonnull</em><br>readLine方法的结果不为空时被抛弃</p>
<h1 id="RV-REM-OF-RANDOM-INT"><a href="#RV-REM-OF-RANDOM-INT" class="headerlink" title="RV_REM_OF_RANDOM_INT"></a>RV_REM_OF_RANDOM_INT</h1><p><em>Remainder of 32-bit signed random integer</em><br>此代码生成一个随机的符号整数，然后计算另一个值的。由于随机数可以是负数，所以其余操作的结果也可以是负面的。考虑使用Random.nextInt（int）方法代替。</p>
<h1 id="SA-LOCAL-DOUBLE-ASSIGNMENT"><a href="#SA-LOCAL-DOUBLE-ASSIGNMENT" class="headerlink" title="SA_LOCAL_DOUBLE_ASSIGNMENT"></a>SA_LOCAL_DOUBLE_ASSIGNMENT</h1><p><em>Double assignment of local variable</em><br>为一个局部变量两次赋值，这样是没有意义的。</p>
<h1 id="SA-LOCAL-SELF-ASSIGNMENT"><a href="#SA-LOCAL-SELF-ASSIGNMENT" class="headerlink" title="SA_LOCAL_SELF_ASSIGNMENT"></a>SA_LOCAL_SELF_ASSIGNMENT</h1><p><em>Self assignment of local variable</em><br>局部变量使用自身给自己赋值</p>
<h1 id="SF-SWITCH-FALLTHROUGH"><a href="#SF-SWITCH-FALLTHROUGH" class="headerlink" title="SF_SWITCH_FALLTHROUGH"></a>SF_SWITCH_FALLTHROUGH</h1><p><em>Switch statement found where one case falls through to the next case</em><br>Switch语句中一个分支执行后又执行了下一个分支。通常case后面要跟break 或者return语句来跳出。</p>
<h1 id="SF-SWITCH-NO-DEFAULT"><a href="#SF-SWITCH-NO-DEFAULT" class="headerlink" title="SF_SWITCH_NO_DEFAULT"></a>SF_SWITCH_NO_DEFAULT</h1><p><em>Switch statement found where default case is missing</em><br>Switch没有默认情况下执行的case语句。</p>
<h1 id="SE-PRIVATE-READ-RESOLVE-NOT-INHERITED"><a href="#SE-PRIVATE-READ-RESOLVE-NOT-INHERITED" class="headerlink" title="SE_PRIVATE_READ_RESOLVE_NOT_INHERITED"></a>SE_PRIVATE_READ_RESOLVE_NOT_INHERITED</h1><p><em>private readResolve method not inherited by subclasses</em><br>声明为private的序列化方不能被子类继承</p>
<h1 id="UCF-USELESS-CONTROL-FLOW"><a href="#UCF-USELESS-CONTROL-FLOW" class="headerlink" title="UCF_USELESS_CONTROL_FLOW"></a>UCF_USELESS_CONTROL_FLOW</h1><p><em>Useless control flow</em><br>没有任何作用的条件语句。</p>
<h1 id="UCF-USELESS-CONTROL-FLOW-NEXT-LINE"><a href="#UCF-USELESS-CONTROL-FLOW-NEXT-LINE" class="headerlink" title="UCF_USELESS_CONTROL_FLOW_NEXT_LINE"></a>UCF_USELESS_CONTROL_FLOW_NEXT_LINE</h1><p><em>Useless control flow to next line</em><br>无效的条件控制语句，注意if (argv.length == 1);以“;”结尾，下面的语句无论是否满足都会运行。<br>if (argv.length == 1);<br>        System.out.println(“Hello, “ + argv[0]);</p>
<h1 id="UWF-FIELD-NOT-INITIALIZED-IN-CONSTRUCTOR"><a href="#UWF-FIELD-NOT-INITIALIZED-IN-CONSTRUCTOR" class="headerlink" title="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"></a>UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR</h1><p><em>Field not initialized in constructor</em><br>字段从来没有在任何构造函数初始化，对象被创建后值为空。如果该字段未被定义就重新赋值会产生一个空指针异常。</p>
<h1 id="XFB-XML-FACTORY-BYPASS"><a href="#XFB-XML-FACTORY-BYPASS" class="headerlink" title="XFB_XML_FACTORY_BYPASS"></a>XFB_XML_FACTORY_BYPASS</h1><p><em>Method directly allocates a specific implementation of xml interfaces</em><br>方法自定义了一种XML接口的实现类。最好是使用官方提供的工厂类来创建这些对象，以便可以在运行期中改变。例如：<br>javax.xml.parsers.DocumentBuilderFactory<br>javax.xml.parsers.SAXParserFactory<br>javax.xml.transform.TransformerFactory<br>org.w3c.dom.Document.createXXXX</p>
<h1 id="其他文章（持续更新）"><a href="#其他文章（持续更新）" class="headerlink" title="其他文章（持续更新）"></a>其他文章（持续更新）</h1><p><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/b8a60a5e.html">FindBugs：简介与使用</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/f6c077f9.html">FindBugs 规则整理：Bad Practice</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/27613e18.html">FindBugs 规则整理：Security &amp; Experimental</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/7a2a5923.html">FindBugs 规则整理：Internationalization</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/7dfffed7.html">FindBugs 规则整理：Malicious Code Vulnerability</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/8a8d645f.html">FindBugs 规则整理：Performance</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/baebe2db.html">FindBugs 规则整理：Multithreaded Correctness</a><br><a target="_blank" rel="noopener" href="http://linbinghe.me/2017/b2ff5786.html">FindBugs 规则整理：CORRECTNESS</a></p>
<h1 id="引用"><a href="#引用" class="headerlink" title="引用"></a>引用</h1><p><em>整合以下文章过程中发现部分存在翻译错误，已做修正，同时感谢以下文章作者</em><br><a target="_blank" rel="noopener" href="https://my.oschina.net/hoodlake/blog/126735">FindBugs使用备忘录</a><br><a target="_blank" rel="noopener" href="http://blog.csdn.net/jdsjlzx/article/details/21472253/">FindBugs规则整理</a><br><a target="_blank" rel="noopener" href="http://blog.csdn.net/yang1982_0907/article/details/18606171">详解FindBugs的各项检测器</a><br><a target="_blank" rel="noopener" href="https://my.oschina.net/bairrfhoinn/blog/156200">Findbugs 缺陷详解与英文代号的对照表</a></p>
<hr>
<p><strong>版权声明</strong></p>
<p><img src="https://tva1.sinaimg.cn/large/007S8ZIlgy1gee6wkfo69j30e9026gm4.jpg" alt="Creative Commons BY-NC-ND 4.0 International License"></p>
<p><a target="_blank" rel="noopener" href="http://linbinghe.me/">Lam’s Blog</a> by <a target="_blank" rel="noopener" href="http://linbinghe.me/">Binghe Lin</a> is licensed under a <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons BY-NC-ND 4.0 International License</a>.<br>由<a target="_blank" rel="noopener" href="http://linbinghe.me/">林炳河</a>创作并维护的<a target="_blank" rel="noopener" href="http://linbinghe.me/">Lam’s Blog</a>采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">创作共用保留署名-非商业-禁止演绎4.0国际许可证</a>。</p>
<p>本文首发于<a target="_blank" rel="noopener" href="http://linbinghe.me/">Lam’s Blog - Knowledeg as Action</a>，版权所有，侵权必究。</p>
<p>本文永久链接：<a target="_blank" rel="noopener" href="http://codinglife.me/2017/eb74f6c5.html">http://codinglife.me/2017/eb74f6c5.html</a></p>

    </div>

    
    
    

    <footer class="post-footer">
          <div class="post-tags">
              <a href="/tags/FindBugs/" rel="tag"># FindBugs</a>
              <a href="/tags/%E8%A7%84%E5%88%99/" rel="tag"># 规则</a>
              <a href="/tags/Dodgy/" rel="tag"># Dodgy</a>
              <a href="/tags/Style/" rel="tag"># Style</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/2017/f6c077f9.html" rel="prev" title="FindBugs 规则整理：Bad Practice">
                  <i class="fa fa-chevron-left"></i> FindBugs 规则整理：Bad Practice
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/2017/7dfffed7.html" rel="next" title="FindBugs 规则整理：Malicious Code Vulnerability">
                  FindBugs 规则整理：Malicious Code Vulnerability <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">


<div class="copyright">
  &copy; 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">LinBinghe</span>
</div>
  <div class="powered-by">Powered by <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a>
  </div>

    </div>
  </footer>

  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/next-boot.js"></script>

  






  





</body>
</html>
